package code.tools.commponents.button
{
	import code.structure.manager.loader.DllLoaderManager;
	import code.structure.manager.font.FontManager;
	import code.structure.manager.sound.MySoundManager;
	import code.tools.commponents.AutoTextField;
	import code.tools.commponents.Component;
	import code.tools.commponents.HBox;
	import code.tools.commponents.Helpers;
	import code.tools.commponents.Style;
	import code.tools.sound.src.SoundName;
	import code.untils.FiltersEnum;
	import code.untils.UiNameConst;
	
	import flash.display.DisplayObjectContainer;
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import flash.filters.DropShadowFilter;
	import flash.filters.GlowFilter;
	import flash.geom.Point;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	import flash.utils.Dictionary;
	
	/**
	 * 文字按钮
	 * width:会根据文本内容，自动绘制背景宽度
	 * 必须有点击后的处理函数onClick
	 * 切换处理函数可直接对onClick赋值新的处理
	 * @author liangqian
	 *
	 */
	public class TextButton extends Component
	{
		private var _over:Boolean                        = false;
		private var _down:Boolean                        = false;
		
		private var _text:String                         = "";
		/**
		 * 文字的显示容器
		 */
		protected var textSb:TextField;
		/**
		 *蓝色按钮 size默认：18
		 */		
		public static const TEXTBUTTON_STYLE_BLUE:int = 10;
		/**
		 *带cash图标的蓝色大按钮  ，size默认：18
		 */		
		public static const TEXTBUTTON_STYLE_WITH_CASH_BLUE_BIG:int = 20;
		/**
		 *红色文字按钮，鼠标移入变颜色  ，size默认：20
		 */		
		public static const TEXTBUTTON_STYLE_RED:int = 30;
		/**
		 *绿色按钮，带礼物icon的  ，size默认：18
		 */		
		public static const TEXTBUTTON_STYLE_WITH_GIFT_GREEN:int = 40;
		/**
		 *绿色按钮，移入换种按钮背景，不是放大  ，size默认：18
		 */		
		public static const TEXTBUTTON_STYLE_GREEN2:int = 50;
		/**
		 *黄色按钮，移入换种按钮背景，不是放大  ，size默认：18
		 */		
		public static const TEXTBUTTON_STYLE_YELLOW2:int = 60;
		/**
		 *go  Button ，size默认：33
		 */		
		public static const TEXTBUTTON_STYLE_GO:int = 70;
		/**
		 *绿色按钮，左边带把锤子 
		 */		
		public static const TEXTBUTTON_STYLE_HAMMER:int = 80;
		/**
		 *绿色按钮，左边带个一键卖出的魔法棒
		 */		
		public static const TEXTBUTTON_STYLE_SELL:int = 90;
		
		private static const BigYellowBtnTextFilters:GlowFilter = new GlowFilter(0xcc6600,1,4,4,6);
		private static const SmallYellowBtnFilters:GlowFilter = new GlowFilter(0xcc9900,1,4,4,6);
		private static const InstantBtnFilters:GlowFilter = new GlowFilter(0x1A7DBF,1,5,5,8);
		
		private static const GREEN2_AND_YELLOW2_BTN_TEXT_GLOWFILTERS:DropShadowFilter = new DropShadowFilter(1,90,0xffffff,1,3,3,1.48);
		
		private static const BTN_NOT_USE_GLOWFILTERS:DropShadowFilter = new DropShadowFilter(2,90,0,1,5,5,.5);
		//		private var BtnFilters0:GlowFilter = new GlowFilter(0xffffff,1,2,2,8);
		//		private var BtnFilters1:DropShadowFilter = new DropShadowFilter(3,45,0,1,0,0,.4);
		
		
		/****************************按钮滤镜样式枚举*******************************/
		/**
		 *白色滤镜 
		 */		
		public static const BTN_FILTERS_WHITE:int = 10;
		/**
		 *黑色滤镜 
		 */		
		public static const BTN_FILTERS_BLACK:int = 20;
		/**
		 *黑色滤镜 2
		 */		
		public static const BTN_FILTERS_BLACK2:int = 40;
		/**
		 *黑色滤镜 3
		 */		
		public static const BTN_FILTERS_BLACK3:int = 50;
		/**
		 *无滤镜 
		 */		
		public static const BTN_FILTERS_NONE:int = 30;
		
		private var _style:int;
		private var btnArea:Component;
		private var _initXpos:Number;
		private var _initYpos:Number;
		public var _widthPos:Number;
		public var _heightPos:Number;
		private var baseTips:BaseTips;
		private var _isShowFilters:int;
		private var _size:int;
		/** 是否是鼠标移入时按钮变色的样式 */
		private var _bool:Boolean;
		/** 是否需要显示花费的图标 */
		private var _isNeedShowCostIcon:Boolean;
		/** 不可用时的滤镜，默认 BTN_NOT_USE_GLOWFILTERS*/
		public var _noUseBtnFilters:Array;
		
		/** 构造函数
		 * @param parent 父级显示容器
		 * @param xpos x坐标
		 * @param ypos y坐标
		 * @param label 所显示的文字
		 * @param defaultHandler 点击的处理方法 defaultHandler(this)
		 * @param style 按钮样式，见本类枚举
		 * @param widthPos 若此值为-1，则自适应，即按钮宽度随文字宽度变化，不为-1则按钮固定为此宽度
		 * @param heightPos 若此值为-1，则自适应，即按钮高度随美术设计的来，不为-1则按钮固定为此高度
		 * @param size  按扭上文字大小，若为-1表示文字size按美术设计的来，不为-1时，当widthPos不为-1时，则文字在widthPos范围内按size显示，显示不下时，size将变为12号字
		 * @param btnFiltersStyle 针对TEXTBUTTON_STYLE_GREEN2和TEXTBUTTON_STYLE_YELLOW2使用的，按钮滤镜样式，默认白色滤镜
		 * 
		 */		
		public function TextButton(parent:DisplayObjectContainer ,xpos:Number ,ypos:Number ,
								   label:String , defaultHandler:Function,style:int = 20, 
								   widthPos:Number = -1,heightPos:Number = -1,
								   size:int = -1,btnFiltersStyle:int = BTN_FILTERS_WHITE)
		{
			_style = style;
			_initXpos = xpos;
			_initYpos = ypos;
			_widthPos = widthPos;
			_heightPos = heightPos;
			_isShowFilters = btnFiltersStyle;
			_size = size;
			super(parent , xpos , ypos);
			onClick = defaultHandler;
			if(label != '')
				setText(label);
		}
		
		private var tbMc:MovieClip;
		/**
		 *skip 花费 
		 */		
		private var costTf:TextField;
		private var glowFilters:Array;
		private var cashIcon:MovieClip;
		
		private var costArea:HBox;
		private var _initWidth:Number;
		private var textCor:uint = 0xffffff;
		private var _defaultSize:int;
		private var textformat:TextFormat;
		private var costTextformat:TextFormat;
		/**
		 * Creates and adds the child display objects of this component.
		 */
		override protected function addChildren():void
		{
			mouseChildren = false;
			buttonMode = true;
			btnArea = new Component(this);
			
			var font:String = FontManager.getInstance().embeddedFontBName;
			textformat = new TextFormat();
			textformat.align = TextFieldAutoSize.LEFT;
			
			costTextformat = new TextFormat();
			costTextformat.align = TextFieldAutoSize.LEFT;
			switch(_style)
			{
				case TEXTBUTTON_STYLE_GREEN2:
					_bool = true;
					if(_isShowFilters == BTN_FILTERS_WHITE)
						tbMc = new (DllLoaderManager.getInstance().getMaterial(UiNameConst.GENERAL_ICON,'greenBtn_small2') as Class) as MovieClip;
					else
						tbMc = new (DllLoaderManager.getInstance().getMaterial(UiNameConst.GENERAL_ICON,'greenBtn_small1') as Class) as MovieClip;
					glowFilters = [GREEN2_AND_YELLOW2_BTN_TEXT_GLOWFILTERS];
					_defaultSize = 18;
					textCor = 0x497E12;
					setBtnFilters();
					break;
				case TEXTBUTTON_STYLE_BLUE:
					_bool = true;
					tbMc = new (DllLoaderManager.getInstance().getMaterial(UiNameConst.GENERAL_ICON,'blueBtn_with_cash') as Class) as MovieClip;
					glowFilters = [FiltersEnum.SHOP_ITEM_BUY_PRICE_DROPSHADOWFILTER];
					_defaultSize = 18;
					textCor = 0x3E6A83;
					setBtnFilters();
					break;
				case TEXTBUTTON_STYLE_RED:
					_bool = true;
					tbMc = new (DllLoaderManager.getInstance().getMaterial(UiNameConst.GENERAL_ICON,'redBtn') as Class) as MovieClip;
					glowFilters = [FiltersEnum.RED_BTN_TEXT_DROPSHADOWFILTER];
					_defaultSize = 20;
					textCor = 0xffffff;
					break;
				case TEXTBUTTON_STYLE_WITH_GIFT_GREEN:
					_isNeedShowCostIcon = true;
					_bool = true;
					tbMc = new (DllLoaderManager.getInstance().getMaterial(UiNameConst.GENERAL_ICON,'greenBtn_small2') as Class) as MovieClip;
					glowFilters = [GREEN2_AND_YELLOW2_BTN_TEXT_GLOWFILTERS];
					_defaultSize = 18;
					cashIcon = new (DllLoaderManager.getInstance().getMaterial(UiNameConst.GENERAL_ICON,'giftIcon') as Class) as MovieClip;
					cashIcon.visible = false;
					textCor = 0x497E12;
					break;
				case TEXTBUTTON_STYLE_WITH_CASH_BLUE_BIG:
					_isNeedShowCostIcon = true;
					tbMc = new (DllLoaderManager.getInstance().getMaterial(UiNameConst.GENERAL_ICON,'blueBtn_with_cash') as Class) as MovieClip;
					glowFilters = [FiltersEnum.SHOP_ITEM_BUY_PRICE_DROPSHADOWFILTER];
					_defaultSize = 18;
					cashIcon = new (DllLoaderManager.getInstance().getMaterial(UiNameConst.GENERAL_ICON,'withCashBtn_big_cash') as Class) as MovieClip;
					cashIcon.visible = false;
					textCor = 0x3E6A83;
					setBtnFilters();
					break;
				case TEXTBUTTON_STYLE_YELLOW2:
					_bool = true;
					if(_isShowFilters == BTN_FILTERS_WHITE)
						tbMc = new (DllLoaderManager.getInstance().getMaterial(UiNameConst.GENERAL_ICON,'yellowBtn_small2') as Class) as MovieClip;
					else
						tbMc = new (DllLoaderManager.getInstance().getMaterial(UiNameConst.GENERAL_ICON,'yellowBtn_small1') as Class) as MovieClip;
					glowFilters = [GREEN2_AND_YELLOW2_BTN_TEXT_GLOWFILTERS];
					_defaultSize = 18;
					textCor = 0x927326;
					setBtnFilters();
					break;
				case TEXTBUTTON_STYLE_GO:
					tbMc = new (DllLoaderManager.getInstance().getMaterial(UiNameConst.GENERAL_ICON,'goBtn') as Class) as MovieClip;
					_defaultSize = 33;
					textCor = 0xa34207;
					glowFilters = [FiltersEnum.TEXT_DROP_SHADOW_FILTERS];
					break;
				case TEXTBUTTON_STYLE_HAMMER:
					_isNeedShowCostIcon = true;
					_bool = true;
					tbMc = new (DllLoaderManager.getInstance().getMaterial(UiNameConst.GENERAL_ICON,'greenBtn_small2') as Class) as MovieClip;
					glowFilters = [GREEN2_AND_YELLOW2_BTN_TEXT_GLOWFILTERS];
					_defaultSize = 24;
					cashIcon = new (DllLoaderManager.getInstance().getMaterial(UiNameConst.GENERAL_ICON,'btnHammerIcon') as Class) as MovieClip;
					cashIcon.visible = false;
					textCor = 0x497E12;
					break;
				case TEXTBUTTON_STYLE_SELL:
					_isNeedShowCostIcon = true;
					_bool = true;
					tbMc = new (DllLoaderManager.getInstance().getMaterial(UiNameConst.GENERAL_ICON,'greenBtn_small2') as Class) as MovieClip;
					glowFilters = [GREEN2_AND_YELLOW2_BTN_TEXT_GLOWFILTERS];
					_defaultSize = 22;
					cashIcon = new (DllLoaderManager.getInstance().getMaterial(UiNameConst.GENERAL_ICON,'sellDessertIcon') as Class) as MovieClip;
					cashIcon.visible = false;
					textCor = 0x4C7A20;
					break;
			}
			textformat.size = _size == -1 ? _defaultSize : _size; 
			costTextformat.size = _size == -1 ? _defaultSize : _size; 
			tbMc.mouseEnabled = tbMc.mouseChildren = false;
			
			if(_heightPos == -1)
				_height = tbMc.height;
			else
				_height = tbMc.height = _heightPos;
			if(_style == TEXTBUTTON_STYLE_WITH_CASH_BLUE_BIG)
				costTf = createTextField(costTf,costTextformat,textCor,FontManager.getInstance().embeddedFonDName);
			_initWidth = tbMc.width;
			btnArea.addChild(tbMc);
			costArea = new HBox(btnArea);
			costArea.spacing = 2;
			textSb = createTextField(textSb,textformat,textCor,FontManager.getInstance().embeddedFontBName);
			if(_style != TEXTBUTTON_STYLE_WITH_GIFT_GREEN && _style != TEXTBUTTON_STYLE_HAMMER &&  _style != TEXTBUTTON_STYLE_SELL)
				costArea.addChild(textSb);
			if(cashIcon)
			{
				cashIcon.mouseEnabled = false;
				costArea.addChild(cashIcon);
			}
			if(costTf)
				costArea.addChild(costTf);
			if(_style == TEXTBUTTON_STYLE_WITH_GIFT_GREEN || _style == TEXTBUTTON_STYLE_HAMMER || _style == TEXTBUTTON_STYLE_SELL)
				costArea.addChild(textSb);
			
			addEventListener(MouseEvent.ROLL_OVER , overHandler);
			addEventListener(MouseEvent.MOUSE_DOWN , downHandler);
		}
		
		///////////////////////////////////
		// private methods
		///////////////////////////////////
		
		private function createTextField(tf:TextField, txtFormat:TextFormat,col:uint,font:String,isNum:Boolean = false):TextField
		{
			tf = Helpers.FormatTextField(btnArea,0,0,10,TextFieldAutoSize.LEFT,col,font);
			if(!isNum && _widthPos != -1)
			{
				if(_isNeedShowCostIcon)
					(tf as AutoTextField).openZoom(_widthPos - cashIcon.width,_height);
				else
					(tf as AutoTextField).openZoom(_widthPos,_height);
				(tf as AutoTextField).setOffsetAtZoom(false);
			}
		
			tf.mouseEnabled = false;
			tf.defaultTextFormat = txtFormat;
			tf.filters = glowFilters;
			return tf;
		}
		
		public function updateTextSize(sizeValue:int):void
		{
			if(getTextSize() == sizeValue)return;
			_size = sizeValue;
			updateUI();
		}
		/** 返回文字大小 */
		public function getTextSize():int
		{
			return _size == -1 ? _defaultSize : _size;
		}
		
		private var _updateTextCallBack:Function;
		/**
		 * 在更新文字时的回调
		 * 
		 */		
		public function updateTextCallBack(func:Function):void
		{
			_updateTextCallBack = func;
		}
		
		private function setBtnFilters():void
		{
			switch(_isShowFilters)
			{
				case BTN_FILTERS_BLACK:
					tbMc.filters = [FiltersEnum.BTN_NEW_BIE_DROPSHADOWFILTER];
					break;
				case BTN_FILTERS_WHITE:
					tbMc.filters = [FiltersEnum.TEXT_BTN_DROPSHADOWFILTER];
					break;
				case BTN_FILTERS_BLACK2:
					tbMc.filters = [FiltersEnum.CHARTS_RECIPE_ICON_DROPSHADOWFILTER];
					break;
				case BTN_FILTERS_BLACK3:
					tbMc.filters = [FiltersEnum.CHARTS_PRIZE_DROPSHADOWFILTER];
					break;
				default:
					tbMc.filters = null;
					break;
			}
		}
		///////////////////////////////////
		// public methods
		///////////////////////////////////
		/**
		 *  onClick(this);
		 */
		public var onClick:Function;
		
		override public function dispose(... rest):void
		{
			super.dispose();
			onClick = null;
			mouseEnabled = false;
			stage.removeEventListener(MouseEvent.MOUSE_UP , upHandler);
			removeEventListener(MouseEvent.MOUSE_OVER , overHandler);
			removeEventListener(MouseEvent.MOUSE_OUT , outHandler);
			removeEventListener(MouseEvent.MOUSE_DOWN , downHandler);
		}
		
		//		private var _isFirstNew:Boolean = true;
		override public function draw():void
		{
			super.draw();
			
			//			if(_isFirstNew){
			//				setTimeout(invalidate,300);
			//			}else{
			updateUI()
			//			}
			
			//			_isFirstNew = false;
		}
		
		private function refreshWid():void
		{
			costArea.draw();
			if(_widthPos != -1)
				_width = _widthPos;
			else
			{
				_width = costArea.width;
				_width = Math.max(_initWidth,_width + 20);
			}
		}
		
		private function updateUI():void{
			textformat.size = _size == -1 ? _defaultSize : _size;
			textSb.defaultTextFormat = textformat;
			textSb.text = _text;
			textSb.visible = _text == '' ? false : true;
			if(_isNeedShowCostIcon)
			{
				costTextformat.size = _size == -1 ? _defaultSize : _size;
				if(costTf)
				{
					costTf.defaultTextFormat = costTextformat;
					costTf.text = _skipCost/*||""*/;
					costTf.y = (tbMc.height - costTf.height)*.5 - 2;
				}
				cashIcon.visible = true;
			}
			else
			{
				if(costTf)
					costTf.visible = false;
				if(cashIcon)
					cashIcon.visible = false;
			}
			//			trace(textSb.text,textSb.textWidth,textSb.width);
			refreshWid();
			costArea.x = (_width - costArea.width) * .5;
			tbMc.getChildAt(0).width =  _width;
			btnArea.draw();
			textSb.y = (_height - textSb.height)*.5 - 1;
			if(cashIcon && cashIcon.visible)
			{
				cashIcon.y = (_height - cashIcon.height)*.5;
				if(_style != TEXTBUTTON_STYLE_WITH_GIFT_GREEN && _style != TEXTBUTTON_STYLE_HAMMER && _style != TEXTBUTTON_STYLE_SELL)
					cashIcon.y += 3;
//				costArea.y = (_height - costArea.height)*.5;//Math.max(0,(_height - costArea.height)*.5);
			}
			btnArea.x = - _width * .5;
			btnArea.y = -_height * .5;
			x = _initXpos;
			y = _initYpos;
		}
		
		override public function set x(value:Number):void
		{
			_initXpos = value;
			super.x = _initXpos + _width * .5;
		}
		
		override public function set y(value:Number):void
		{
			_initYpos = value;
			if(tbMc)
				super.y = _initYpos + tbMc.height * .5;
			else
				super.y = _initYpos;
		}
		
		///////////////////////////////////
		// event handlers
		///////////////////////////////////
		/**
		 * Internal mouseOver handler.
		 * @param event The MouseEvent passed by the system.
		 */
		protected function overHandler(event:MouseEvent):void
		{
			addEventListener(MouseEvent.ROLL_OUT , outHandler);
			if(_over)return;
			_over = true;
			MySoundManager.playSound(SoundName.MOUSE_OVER, 0.2);
			if(enable)
			{
				tbMc.gotoAndStop(2);
				tbMc.getChildAt(0).width =  _width;
			}
			else
			{
				if(notEnableHoverTips == null)
					return;
				else{
					var gPoint:Point = this.localToGlobal(new Point(0,0));
					//baseTips = TipsFactoray.getTips(TipsFactoray.TIPS_TYPE_ONLY_TEXT_WITH_ALERT_LAYER,(ContextIntance.getContext().commonView as AppCommonView).appContainer.popupTipsLayer);
					baseTips.show(this,notEnableHoverTips,gPoint.x - _width * .5,gPoint.y-_height*.5);
				}
			}
		}
		
		private function outCompleteHandler():void
		{
			if(enable == false && notEnableHoverTips == null)return;
			removeEventListener(MouseEvent.ROLL_OUT , outHandler);
			if (!_down)
				invalidate();
		}
		/**
		 * Internal mouseOut handler.
		 * @param event The MouseEvent passed by the system.
		 */
		protected function outHandler(event:MouseEvent):void
		{
			if(!_over)return;
			_over = false;
			if(baseTips)
				baseTips.close();
			if(enable)
			{
				tbMc.gotoAndStop(1);
				tbMc.getChildAt(0).width =  _width;
			}
		}
		
		private function downHandler(event:MouseEvent):void
		{
			_down = true;
			stage.addEventListener(MouseEvent.MOUSE_UP , upHandler);
			event.stopPropagation();
		}
		
		private function upHandler(e:MouseEvent):void
		{
			/*需要keeplive的组件 可能在按住状态切换*/
			if (stage == null)
			{
				e.currentTarget.removeEventListener(MouseEvent.MOUSE_UP , upHandler);
				return;
			}
			stage.removeEventListener(MouseEvent.MOUSE_UP , upHandler);
			_down = false;
			if(enable)
			{
				tbMc.gotoAndStop(2);
				tbMc.getChildAt(0).width =  _width;
			}
			invalidate();
			if (_over &&　mouseEnabled)
				onClick(this);
			MySoundManager.playSound(SoundName.BUTTON_CLICK, 0.2);
			e.stopPropagation();
		}
		
		///////////////////////////////////
		// getter/setters
		///////////////////////////////////
		/**
		 * 使用字符字节长度作为key
		 * 对应的bitmapData为value
		 */
		private static const DIC_BACK_NORMAL:Dictionary  = new Dictionary;
		private static const DIC_BACK_HOVER:Dictionary   = new Dictionary;
		private var textNormalColor:int                  = Style.COLOR_BUTTON_LABEL;
		
		private var _skipCost:String  = '';
		/**
		 *设置按钮文字  
		 * @param t 按钮文字
		 * @param skipCost 只在TEXTBUTTON_STYLE_WITH_CASH_SMALL或TEXTBUTTON_STYLE_WITH_CASH_BIG模式下需要设置此参数
		 * 表示skip 时的花费
		 * 
		 */		
		public function setText(t:String,skipCost:* = null):void
		{
			//			if (_text == t)
			//				return;
			_text = t || '';
			_skipCost = skipCost || '';
			draw();
			if(_updateTextCallBack != null)_updateTextCallBack(this,getTextSize());
			//			invalidate();
		}
		
		public function get text():String
		{
			return _text;
		}
	
		private var _notEnableHoverTips:String;
		
		private var _enable:Boolean = true;
		public function set enable(v:Boolean):void
		{
			_enable = v;
			//			if(_style != TEXTBUTTON_STYLE_GREEN_SMALL)return;
			//			buttonMode = mouseEnabled = v;
			this.scaleX = this.scaleY = 1;
			if(v)
			{
				buttonMode = true;
				addEventListener(MouseEvent.MOUSE_DOWN , downHandler);
				textSb.textColor = textCor;
				setBtnFilters();
				if(costTf)
				{
					costTf.textColor = textCor;
					costTf.filters = [FiltersEnum.SHOP_ITEM_BUY_PRICE_DROPSHADOWFILTER];
				}
				if(cashIcon)
					cashIcon.filters = null;
				tbMc.gotoAndStop(1);
			}
			else
			{
				removeEventListener(MouseEvent.MOUSE_DOWN , downHandler);
				if(notEnableHoverTips == null)
					buttonMode = false;
				else
					buttonMode = true;
				
//				if(_style == TEXTBUTTON_STYLE_GREEN2 || _style == TEXTBUTTON_STYLE_YELLOW2 || _style == TEXTBUTTON_STYLE_WITH_CASH_BLUE_BIG || _style == TEXTBUTTON_STYLE_RED || _style == TEXTBUTTON_STYLE_WITH_GIFT_GREEN)
//				{
					textSb.textColor = 0x666666;
					tbMc.gotoAndStop(3);
					tbMc.filters = _noUseBtnFilters == null ? [BTN_NOT_USE_GLOWFILTERS] : _noUseBtnFilters;
					if(costTf)
						costTf.textColor = 0x666666;
//				}
//				else
//				{
//					if(costTf)
//					{
//						costTf.textColor = 0xffffff;
//						costTf.filters = [FiltersEnum.NO_USE_BTN_FILTERS];
//					}
//					textSb.filters = [FiltersEnum.NO_USE_BTN_FILTERS];
//					tbMc.gotoAndStop(2);
//				}
				if(cashIcon)
					cashIcon.filters = _noUseBtnFilters == null ? [BTN_NOT_USE_GLOWFILTERS] : _noUseBtnFilters;
			}
			tbMc.getChildAt(0).width =  _width;
		}
		
		public function get enable():Boolean
		{
			return _enable;
		}
		
		/**
		 *按钮不可点时，是否需要鼠标移入时的tips 
		 * @return 
		 * 
		 */		
		public function get notEnableHoverTips():String
		{
			return _notEnableHoverTips;
		}
		
		public function setNotEnableHoverTips(value:String,tipsLayer:DisplayObjectContainer):void
		{
			_notEnableHoverTips = value;
			baseTips = TipsFactoray.getTips(TipsFactoray.TIPS_TYPE_ONLY_TEXT_WITH_ALERT_LAYER,tipsLayer);
		}
	}
}